module.exports = function($scope, $state, $stateParams, $modalInstance, $resource,$modal,toaster, item, flag){
  $scope.info = {
    'apply_id' : item.apply_id,
    'indexlist' : item.indexlist
  }
  var url = '';
  if (flag == 'pass'){
    url = '/api/ac/goc/viewAlevelApplyService/updateViewApplyCategoryStateOn';
  } else if (flag == 'reject') {
    url = '/api/ac/goc/viewAlevelApplyService/updateViewApplyCategoryStateOff';
  }
  $scope.ok = function() {
    $resource(url, {}, {}).
      save($scope.info,  function (res) {
          if (res.errcode != 0) {
              toaster.error({title:"",body:res.errmsg});
              return;                      
          }     
          console.log(res);
          toaster.success({title:"",body:'操作成功'});     
          $modalInstance.close(); 
    });    
  }
  $scope.cancel = function(){
    $modalInstance.close(); 
  }
};